//
//  LFBDetailProductInfoView.m
//  loveFreshBeen
//
//  Created by Feng on 2017/7/11.
//  Copyright © 2017年 feng. All rights reserved.
//

#import "LFBDetailProductInfoView.h"
#import <UIImageView+WebCache.h>

@interface LFBDetailProductInfoView ()

@property (weak, nonatomic) IBOutlet UIImageView *productImageView;
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
@property (weak, nonatomic) IBOutlet UILabel *partnerPriceLabel;
@property (weak, nonatomic) IBOutlet UILabel *marketPriceLabel;
@property (weak, nonatomic) IBOutlet UILabel *brandLabel;
@property (weak, nonatomic) IBOutlet UILabel *specificsLabel;

@end

@implementation LFBDetailProductInfoView

+ (instancetype)detailProductInfoView
{
    return [[NSBundle mainBundle] loadNibNamed:@"detailProductInfo" owner:nil options:nil].lastObject;
}

- (void)setModel:(LFBShoppingCartModel *)model
{
    _model = model;
    
    [self.productImageView sd_setImageWithURL:[NSURL URLWithString:model.img] placeholderImage:[UIImage imageNamed:@"v2_placeholder_full_size"]];
    
    self.nameLabel.text = model.name;
    self.partnerPriceLabel.text = [NSString stringWithFormat:@"$%.2f",model.partner_price];
//    self.marketPriceLabel.text = [NSString stringWithFormat:@"$%.2f",model.market_price];
    NSString *marketPriceStr = [NSString stringWithFormat:@"$%.2f",model.market_price];
    //添加中划线
    NSDictionary *attributeDict = @{NSStrikethroughStyleAttributeName: [NSNumber numberWithInteger:NSUnderlineStyleSingle]};
    NSMutableAttributedString *attributeStr = [[NSMutableAttributedString alloc] initWithString:marketPriceStr attributes:attributeDict];
    self.marketPriceLabel.attributedText = attributeStr;
    
    self.brandLabel.text = model.brand_name;
    self.specificsLabel.text = model.specifics;
}

@end
